/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.documentar.DAO;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author Robertto
 */
public class LoginDAO extends AbstractDAO {

    public boolean AutenticarUsuario(br.com.documentar.model.LoginModel model) {
        try {
            ConnectDataBase();
            String sql = "";
            String senha = "";
            sql = "SELECT TCOL_SENHA FROM tcol_colaborador WHERE TCOL_CODIGO_PK = " + model.getUsuario() + "";
            rs = Select(sql, model.getNomeTela());
            while (rs.next()) {
                senha = rs.getString("TCOL_SENHA");
            }
            if (model.getSenha().equals(senha)) {
                return true;
            } else {
                return false;
            }
        } catch (SQLException ex) {
            ex.getStackTrace();
            return false;
        } finally {
            Desconectar(model.getNomeTela());
        }
    }

}
